package com.example.xyxwebbackend001.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.example.xyxwebbackend001.model.entity.TodayRecommend;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface TodayRecommendMapper extends BaseMapper<TodayRecommend> {
        @Select("<script>" +
                "SELECT * FROM today_recommend " +
                "<where>" +
                "   <if test='cityId != null'>city_id = #{cityId}</if>" +
                "</where>" +
                "<if test='cityId == null'>ORDER BY rec_date DESC LIMIT 4</if>" +
                "</script>")
        List<TodayRecommend> getTodayRecommendList(@Param("cityId") String cityId);
}
